import { useEffect, useRef } from "react";
type EffectEvent = () => void;
function useEffectEvent(effect: EffectEvent) {
  const effectRef = useRef(effect);
  useEffect(() => {
    effectRef.current = effect;
  });

  return effectRef.current;
}

export default useEffectEvent;
